<template>
  <div align="center" style="height: 690px">
      <div>
        <el-row>
            <el-col :span="24"><div class="grid-content bg-purple-dark">膳食方案</div></el-col>
            <el-col :span="24"><div class="grid-content bg-purple-dark">
                <el-table
                    height="280"
                    :data="tableData"
                    style="width: 100%">
                    <el-table-column
                        prop="foodName"
                        label="推荐食物">
                    </el-table-column>
                    <el-table-column
                        prop="illustrate"
                        label="说明">
                    </el-table-column>
                </el-table>    
            </div></el-col>
        </el-row>
      </div>
      <el-row>
          <el-col :span="24"><div class="grid-content bg-purple-dark"><br><br><br></div></el-col>
      </el-row>
      <div>
        <el-row>
            <el-col :span="24"><div class="grid-content bg-purple-dark">运动方案</div></el-col>
            <el-col :span="24"><div class="grid-content bg-purple-dark">
                <el-table
                    height="280"
                    :data="tableData1"
                    style="width: 100%">
                    <el-table-column
                        prop="pname"
                        label="推荐运动">
                    </el-table-column>
                    <el-table-column
                        prop="announcements"
                        label="说明">
                    </el-table-column>
                </el-table>    
            </div></el-col>
        </el-row>
      </div>
  </div>
</template>

<script>
import { finddietByid,findexerciseByid} from "@/api/therapy";

export default {
    data(){
        return{
            tableData:[],
            tableData1:[]
        }
    },
    methods:{
        select(){
            //sessionStorage.getItem('fn')
            finddietByid(sessionStorage.getItem('fn'))
            .then((response) => {
                findexerciseByid(sessionStorage.getItem('fn'))
                .then((response2) => {
                    console.log(response);
                    this.tableData=response.data
                    this.tableData1=response2.data
                })
                .catch((error) => {
                    this.outputError(error);
                });
            })
            .catch((error) => {
                this.outputError(error);
            });
        }
    },
    created(){
        if (window.sessionStorage) {
            const data = sessionStorage.getItem("is_login");
            console.log(data);
            if (data!=null && data!="") {
                console.log(12)
            } else {
                this.$router.push({
                path: '/patientlogin',
                })
                return
            }
        }
        this.select()
    }

}
</script>

<style>

</style>